﻿using System;

namespace Communication.DataReceivedEvent.Can;

public class CanInfo : IDataReceivedEventInfo
{
    /// <summary>
    ///     设备类型号
    /// </summary>
    public DeviceType Device { get; init; }

    /// <summary>
    ///     设备索引
    /// </summary>
    public int DeviceInd { get; init; }

    /// <summary>
    ///     第几路 CAN。
    /// </summary>
    public int CanInd { get; init; }

    /// <summary>
    ///     波特率
    /// </summary>
    public int BaudRate { get; init; }

    public DataReceivedEventDevice Type => DataReceivedEventDevice.Can;

    public string ToString(string? format, IFormatProvider? formatProvider)
    {
        return $"{Type}-{Device}-{DeviceInd}-{CanInd}-{BaudRate}";
    }
}